/**
 * 假设已经读入了数据，数据内容为data
 */
 const data = [['Alice',12243341221],['David',12243341222],['Mike',12243341223],['Bob',12243341224]];
 function Dictionary() {
     this.dataStore = new Array();
     this.add = add;
     this.showAll = showAll;
     this.find = find;
     this.remove = remove;
     this.clear = clear;
 }
 // 增加新电话号码
 function add(key,value) {
     this.dataStore[key] = value;
 }
 // 查找单个电话号码
 function find(key) {
     console.log(key + '->' + this.dataStore[key])
 }
 // 显示所有电话号码
 function showAll() {
     for(let key of Object.keys(this.dataStore)) {
         console.log(key + '->' + this.dataStore[key])
     }
 }
 // 删除电话号码
 function remove(key) {
     delete this.dataStore[key];
 }
 // 清空所有电话号码
 function clear() {
     for(let key of Object.keys(this.dataStore)) {
         this.remove(key)
     }
 }
 const messages = new Dictionary();
 for (let item of data) {
     messages.add(item[0],item[1]);
 }
 messages.find('Mike');
 messages.showAll();
 messages.remove('Mike');
 messages.showAll();
 messages.clear();
 messages.showAll();
